package com.example.myapplication.db;

import android.accounts.Account;
import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

public class DBOpenHelper extends SQLiteOpenHelper {
    private static final String CREATE_USER = "create table user(" +
            " id integer primary key autoincrement," +
            " phone varchar(20) not null," +
            " password varchar(60) not null," +
            " alipayCode varchar(40))";
    private static final String CREATE_ACCOUNT = "create table account(" +
            " id integer primary key autoincrement," +
            " money float not null," +
            " year integer not null," +
            " month integer not null," +
            " day integer not null," +
            " type varchar(10) not null," +
            " remark varchar(100) default '无'," +
            " in_out varchar(10) not null," +
            " user_id integer not null)";

    public DBOpenHelper(@Nullable Context context) {
        super(context, "bill_app.db", null, 1);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_ACCOUNT);
        db.execSQL(CREATE_USER);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
